package com.qf.web;

import com.qf.service.UserService;
import com.qf.service.serviceimpl.UserServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
 * 删除用户
 * */
@WebServlet("/deleteUserServlet")
public class DeleteUserServlet extends HttpServlet {

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");//处理请求中文乱码
        response.setContentType("text/html;charset=utf-8");//设置响应中文乱码
        String uid = request.getParameter("uid");
        /*System.out.println(uid);*/
        UserService us = new UserServiceImpl();
        us.deleteUser(uid);
        response.sendRedirect(request.getContextPath()+"/admin/deleteuser.jsp");
    }

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request,response);
    }
}
